<?php
class Signup extends CI_Controller{
function index(){
if($this->session->userdata('login')!=TRUE){
$this->load->view('signup');
}else{
$this->load->view('dashboard');
}
}
function sign(){
$username= $this->input->post('username',TRUE);
$password=$this->input->post('password',TRUE);
$nama_depan=$this->input->post('nama_depan',TRUE);
$nama_belakang=$this->input->post('nama_belakang',TRUE);
$email=$this->input->post('email',TRUE);

$query="select * from  user where `username`= '$username'";
$r=$this->db->query($query);
if ($r->num_rows!=0){
$this->load->view('signup');
}
else{
$query="insert into user (`username`,`namadepan`,`namabelakang`,`password`,`email`) values ('$username','$namadepan','$namabelakang','$password','$email')";
$this->db->query($query);


}



}


}